package net.forsuber;

import net.forsuber.schedule.Scheduler;

import java.util.ArrayList;
import java.util.prefs.Preferences;

/**
 * User: lzap
 * Date: 27.7.2007
 * Time: 22:27:25
 */
public class FormSubmiter {

    private ArrayList<Scheduler> schedulers = new ArrayList<Scheduler>();

    public ArrayList<Scheduler> getSchedulers() {
        return schedulers;
    }

    public void setSchedulers(ArrayList<Scheduler> schedulers) {
        this.schedulers = schedulers;
    }

    public void run() throws Exception {
        Preferences preferences = Preferences.userRoot().node("net.forsuber.perferences");

        for (Scheduler scheduler : getSchedulers()) {
            scheduler.init(preferences);
            scheduler.run();
            scheduler.destroy();
            preferences.flush();
        }
    }
}
